Skip to content

Checkpoint related columns in PG 17 have been moved from pg_stat_bgwriter to pg_stat_checkpointer #1072

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

n-rodriguez
Copy link
Contributor

@n-rodriguez n-rodriguez commented Oct 7, 2024

@n-rodriguez n-rodriguez force-pushed the wip/checkpoints_timed branch 4 times, most recently from 9f9dc26 to 40e2774 Compare October 7, 2024 16:51
@n-rodriguez n-rodriguez force-pushed the wip/checkpoints_timed branch from 40e2774 to b08b70d Compare October 17, 2024 18:05
@n-rodriguez n-rodriguez force-pushed the wip/checkpoints_timed branch 2 times, most recently from 49b1a80 to 65abcb5 Compare October 28, 2024 18:15
@n-rodriguez
Copy link
Contributor Author

Hi there! Any news?

@n-rodriguez
Copy link
Contributor Author

Ping @sysadmind

@n-rodriguez n-rodriguez force-pushed the wip/checkpoints_timed branch from 65abcb5 to 578f4d6 Compare November 13, 2024 00:53
@BupycHuk
Copy link

@SuperQ @wrouesnel @sysadmind, could you please reiew this PR, it's important for PG17 monitoring.

@michael-todorovic
Copy link
Contributor

Hello,
I was interested in this PR as we start to get some PG17. However, we moved to multi-target pattern and we're encountering some issues with PG<17. Here's what I did:

I start a very simple PG16:

docker run --rm -p 5416:5432 -e POSTGRES_PASSWORD=postgres postgres:16 -d postgres

I have a config.yml so the exporter can remotely connect to PG:

auth_modules:
  monitoring:
    type: userpass
    userpass:
      username: postgres
      password: postgres

I start the exporter (with the merged PR):

./postgres_exporter --config.file=config.yml --collector.stat_checkpointer

and I call the exporter:

curl 'http://localhost:9187/probe?auth_module=monitoring&target=localhost:5416/postgres?sslmode=disable'

The exporter outputs this error:

time=2024-11-27T14:32:02.679+01:00 level=ERROR source=collector.go:201 msg="collector failed" target="localhost:5416/postgres?sslmode=disable" name=stat_checkpointer duration_seconds=0.013500983 err="pq: relation \"pg_stat_checkpointer\" does not exist"

I'll try to check how to improve the current PR so it can work in this mode 😄

michael-todorovic added a commit to michael-todorovic/postgres_exporter that referenced this pull request Nov 27, 2024
@n-rodriguez
Copy link
Contributor Author

ping @sysadmind @wrouesnel @SuperQ

Copy link
Contributor

@sysadmind sysadmind left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the code is good and should be good to merge as soon as the Copyright dates are updated.

@michael-todorovic
Copy link
Contributor

👋 @n-rodriguez , would you please check the changes in n-rodriguez#1?
In multi-target mode, the current MR is preventing the exporter to work so I provided some fixes for it :)

@sysadmind
Copy link
Contributor

The last commit is missing the DCO

Signed-off-by: Nicolas Rodriguez <[email protected]>
@n-rodriguez n-rodriguez force-pushed the wip/checkpoints_timed branch from 9513603 to 39cd321 Compare January 1, 2025 20:59
@n-rodriguez
Copy link
Contributor Author

The last commit is missing the DCO

Done :)

@sysadmind sysadmind merged commit bea2609 into prometheus-community:master Jan 1, 2025
11 checks passed
@djhoese
Copy link

djhoese commented Feb 6, 2025

Is there any roadmap to a release that includes this bug fix?

@SangeethKarunaratne
Copy link

@sysadmind can we get a release for this fix? 👀

@kerams
Copy link

kerams commented Feb 15, 2025

Any recommendations for a different Postgres monitoring project, ideally Prometheus-based? This repo is as good as dead. Having to drag one of the maintainers kicking and screaming to merge a couple of PRs every quarter just doesn't cut it for a project that aspires to be the semi-official Postgres exporter.

@pcace
Copy link

pcace commented Feb 18, 2025

can you not just deploy quay.io/prometheuscommunity/postgres-exporter:master? its in there..

@SuperSandro2000
Copy link

No. That will definitely be forgotten and byte back in the future.

@michael-todorovic
Copy link
Contributor

On our side, we have built a versionned image with patches coming from existing PRs, waiting for them to be merged. This requires low maintenance but that the current cost to have required feats for our production

@michael-todorovic
Copy link
Contributor

If that can help someone, here's my Dockerfile to build a custom image with PRs patches below. I use it for multi-target setup with consul service discovery, hosted in k8s. You're free to use it the way you prefer, the image doesn't force anything 😄
Note that SOFTWARE_VERSION can be a commit sha from master as well. That's the way I used it until 0.16.0 came out with a patch I needed.

FROM golang:1.23.0 AS build

ARG UPSTREAM_REPO=github.com/prometheus-community/postgres_exporter
ARG SOFTWARE_VERSION=v0.16.0

WORKDIR ${GOPATH}/src/${UPSTREAM_REPO}

RUN apt-get update -qyy && apt install -qyy --no-install-recommends patch curl git ca-certificates
RUN git clone https://${UPSTREAM_REPO} ${GOPATH}/src/${UPSTREAM_REPO} && git checkout ${SOFTWARE_VERSION}
# index collector
RUN curl -s -f https://patch-diff.githubusercontent.com/raw/prometheus-community/postgres_exporter/pull/1071.diff | patch -p1 -i -
# pg17 fix about checkpointer
RUN curl -s -f https://patch-diff.githubusercontent.com/raw/prometheus-community/postgres_exporter/pull/1072.diff | patch -p1 -i -
# fix for #1072 to handle pg<17
RUN curl -s -f https://patch-diff.githubusercontent.com/raw/n-rodriguez/postgres_exporter/pull/1.diff | patch -p1 -i -
# fix: handle pg_replication_slots on pg<13
RUN curl -s -f https://patch-diff.githubusercontent.com/raw/prometheus-community/postgres_exporter/pull/1098.diff | patch -p1 -i -
RUN make build

FROM busybox:stable

COPY --from=build /go/src/github.com/prometheus-community/postgres_exporter/postgres_exporter /bin/postgres_exporter
COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/

ENTRYPOINT [ "/bin/postgres_exporter" ]

@CarpathianUA
Copy link

We need this to be released, for adequate Postgres 17 support!

@sysadmind
Copy link
Contributor

I have a release staged. It looks like #1112 would be important to merge before the release, but needs a fix for the tests. I'm hoping to have the next release out this week and then take another pass to review open PRs here.

@sysadmind
Copy link
Contributor

https://github.com/prometheus-community/postgres_exporter/releases/tag/v0.17.0

@SangeethKarunaratne
Copy link

Thank you @sysadmind !! 🎉 🚀

@n-rodriguez
Copy link
Contributor Author

n-rodriguez commented Feb 23, 2025

Sadly I don't appear in contributors list : https://github.com/prometheus-community/postgres_exporter/releases/tag/v0.17.0 😢 (I think because of the typo: [BIGFIX] => [BUGFIX]

@sysadmind
Copy link
Contributor

I fixed the typo. I see you show up in the list.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

checkpoints_timed not found when monitoring Postgres 17beta3
10 participants